# Maintainer: Peter Budai <peterbudai@hotmail.com>

_realname=testpath
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.3.1
pkgrel=1
pkgdesc="Test utilities for code working with files and commands (mingw-w64)"
url="http://pypi.python.org/pypi/testpath"
arch=('any')
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python3")
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools")
source=(${_realname}-${pkgver}.tar.gz::https://github.com/jupyter/${_realname}/archive/$pkgver.tar.gz
        ${_realname}-${pkgver}-whl.tar.gz::https://files.pythonhosted.org/packages/py2.py3/t/${_realname}/${_realname}-${pkgver}-py2.py3-none-any.whl)
sha256sums=('acd1e9ae3582e03b806ebcc40fbb2c660032d3f3ad991e5460e6856d69e6ba12'
            '039fa6a6c9fd3488f8336d23aebbfead5fa602c4a47d49d83845f55a595ec1b4')


prepare() {
  cd "$srcdir"/

  rm testpath/cli*.exe
  sed -i '/cli-32.exe/d' testpath-$pkgver.dist-info/RECORD
  sed -i '/cli-64.exe/d' testpath-$pkgver.dist-info/RECORD
  sed -i 's/shutil.copy(src, dst)/return/' testpath/commands.py
}

package() {

  cd "$srcdir/${_realname}"
  for _i in ./*; do
    install -Dm644 $_i "$pkgdir/${MINGW_PREFIX}/lib/python3.6/site-packages/${_realname}/$_i"
  done

  _dist="${_realname}-$pkgver.dist-info"
  cd "$srcdir/$_dist"
  for _i in ./*; do
    install -Dm644 $_i "$pkgdir/${MINGW_PREFIX}/lib/python3.6/site-packages/$_dist/$_i"
  done

  cd "$srcdir/${_realname}-$pkgver"
  install -Dm644 LICENSE "$pkgdir/${MINGW_PREFIX}/share/licenses/$pkgname/LICENSE"
}
